package com.ruoyi.web.work.controller;

import com.ruoyi.web.common.Result;
import com.ruoyi.web.work.domain.dbo.WasteTypeDO;
import com.ruoyi.web.work.service.DictService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Comparator;
import java.util.List;

import static com.ruoyi.web.common.Results.ok;

/**
 * 流转作业卡Controller
 *
 * @author gsx
 * @date 2021-02-28
 */
@RestController
@RequestMapping("/work/dict")
public class DictController {

    @Resource
    private DictService dictService;

    /**
     * 查询废品类型
     */
//    @PreAuthorize("@ss.hasPermi('work:basic:remove')")
    @PostMapping("/queryWasteTypeList")
    public Result queryWasteTypeList() {
        List<WasteTypeDO> list = dictService.list();
        list.sort(Comparator.comparing(WasteTypeDO::getColor));
        return ok(list);
    }
}
